package com.itany.cloud.controller;

import com.itany.cloud.config.DataSourceConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ns")
@RefreshScope
public class NameSpaceController {

    @Value("${config.info}")
    private String info;
    @Value("${db.driver}")
    private String driver;
    @Value("${db.url}")
    private String url;
    @Value("${db.username}")
    private String username;
    @Value("${db.password}")
    private String password;

    @GetMapping("/find")
    public DataSourceConfig find() {
        return new DataSourceConfig(driver, url, username, password, info);
    }
}
